<cfmodule template="../../tag/layout.cfm" bodyIsEasyUILayout="false">
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script>
<cfscript>
	if( structKeyExists(rc, "smsid")  && rc.smsid > 0 ){
		smsid = rc.smsid;
	}else{
		smsid = 0;
	}
	
	if( structKeyExists(rc, "fromuserid")  && rc.fromuserid > 0 ){
		fromuserid = rc.fromuserid;
	}else{
		fromuserid = 0;
	}
	
	if( structKeyExists(rc, "touserid")  && rc.touserid > 0 ){
		touserid = rc.touserid;
	}else{
		touserid = 0;
	}
</cfscript>

<form method="post" class="form">
<cfoutput>
<input type="hidden" name="smsid" id="smsid" value="#smsid#">
<input type="hidden" name="fromUserId" id="fromUserId" value="#fromUserId#">
<input type="hidden" name="toUserId" id="toUserId" value="#toUserId#">
</cfoutput>
  <div title="基本信息" style="padding:10px">
    <table class="table" id="table" name="table" width="100%">
      <tbody>
        <tr>
          <th>标题</th>
          <td><input id="subject" name="subject" class="easyui-validatebox" data-options="required:true" style=" width:380px;"/></td>
        </tr>
        <tr>
          <th>内容</th>
          <td>
          	<textarea id="content" name="content" style="width:380px; height:250px;" class="easyui-validatebox" data-options="required:true"></textarea>
          	<input type='button' mode='0' class='editor' onclick="EditorRender('content',$(this))" value='切换至编辑器'>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</form>

</cfmodule>
<script type="text/javascript">
	var closeDialog = function($dialog) {
		$dialog.dialog('destroy');
	}
	
	var submitNow = function($dialog) {
		url = '?action=sms.replysms';
		//alert( $.toJSON( fw.serializeObject($('form')) ));
		$.post(url, fw.serializeObject($('form')), function(result) {
			if (result) {
	        	$dialog.dialog('destroy');
			}
		}, 'json');
	};
	
	var submitForm = function($dialog) {
		//验证前先把编辑器转成编辑框
		if($('.editor').attr('mode') == 1){
			$('.editor').click();
		}
		
		if ($('form').form('validate')) {
			submitNow($dialog);
		} 
		
	};
	
</script>